<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>父组件传值给子组件</title>
</head>

<body>
    <!-- 父组件 -->
    <div id="app">
        <input v-model="msg" />
        <child :msg="msg"></child>
    </div>
    <!-- 子组件 -->
    <template id="sontem">
        <h2>{{msg}}</h2>
    </template>
</body>

</html>
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            msg: "hello"
        },
        components: {
            "child": {
                template: "#sontem",
                props: ["msg"]
            }
        }
    })
</script>